from django.db import models

class CustomerInfo(models.Model):
    wx_open_id = models.CharField(max_length=200, unique=True)
    nickname = models.CharField(max_length=200, null=True, blank=True)
    gender = models.CharField(max_length=1, default='1')
    avatar_url = models.CharField(max_length=200, null=True, blank=True)
    phone = models.CharField(max_length=11, null=True, blank=True)
    status = models.SmallIntegerField(default=1)
    create_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    is_deleted = models.SmallIntegerField(default=0)

    class Meta:
        db_table = 'customer_info'  # 只需要表名，不需要带数据库名
        verbose_name = '客户信息'
        verbose_name_plural = '客户信息'
        # using = 'daijia_customer_db'
        # 指定使用的数据库（在settings.py中配置的数据库别名）
        # using = 'default'  # 这里填写你在settings.py中配置的数据库别名
    # tostring方法
    def __str__(self):
        return self.nickname or self.wx_open_id